//
//  LoadingPageController.m
//  Bracelet
//
//  Created by steve on 15-3-20.
//  Copyright (c) 2015年 jing zhao. All rights reserved.
//

#import "LoadingPageController.h"
#import "APIHSBCWord.h"
@interface LoadingPageController (){
  NSNotificationCenter *notiCenter;
}

@end

@implementation LoadingPageController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
  
  self.skipBtn.layer.borderWidth = 1;
  self.skipBtn.layer.borderColor = [UIColor colorWithRed:110/255.0f green:110/255.0f blue:110/255.0f alpha:1.0f].CGColor;
  
  notiCenter = [NSNotificationCenter defaultCenter];
  [notiCenter addObserver:self selector:@selector(skipBtnClicked:) name:@"RemoveLoadingPage" object:nil];
  
  [self.indicator startAnimating];
  [self updateNetwork];
}
-(void)updateNetwork
{

  [APIHSBCWord getHSBCWorldWithData:@{@"flag":@"loadding"} Success:^(APIHSBCWord *world) {
    
    [self.webView loadHTMLString:world.strHtml baseURL:nil];
    
    [self.indicator stopAnimating];
    
  } failure:^(NSError *error) {
    
    [self.indicator stopAnimating];
    
  }];
}
-(BOOL)prefersStatusBarHidden{
  return YES;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)skipBtnClicked:(id)sender {
  [self.view removeFromSuperview];
  [self removeFromParentViewController];
}
-(void)dealloc{
  [[NSNotificationCenter defaultCenter] removeObserver:self name:@"RemoveLoadingPage" object:nil];
}
@end
